package com.example.app1.web.Test2FeignInterceptor.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class AuditController {

    // 测试feign拦截器 传递审计信息
    // 发送端可能传过来的是json，要解析，这里简单点。直接RequestHeader 接收
    @PostMapping("/audit")
    public String audit(@RequestHeader("operatorName") String operatorName,
                        @RequestHeader("token") String token) {
        log.info(operatorName);
        log.info(token);
        return operatorName + ":" + token;
    }
}
